package svc

import (
	"github.com/zeromicro/go-zero/core/stores/sqlx"
	"good_rpc/internal/config"
	"good_rpc/models"
)

type ServiceContext struct {
	Config    config.Config
	GoodModel models.GoodModel
	Conn      sqlx.SqlConn
}

func NewServiceContext(c config.Config) *ServiceContext {
	conn := sqlx.NewMysql(c.Mysql.DataSource)
	return &ServiceContext{
		Config:    c,
		GoodModel: models.NewGoodModel(conn, c.Cache),
		Conn:      conn,
	}
}
